home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / glossy.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  10.0 KB  |  271 lines

  1. ; glossy-patterned-shadowed-and-bump-mapped-logo
  2. ; creates anything you can create with it :)
  3. ; (use it wisely, use it in peace...)
  4. ;
  5. ; The GIMP -- an image manipulation program
  6. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  7. ;
  8. ; glossy gives a glossy outlook to your fonts (unlogical name, isn't it?)
  9. ; Copyright (C) 1998 Hrvoje Horvat
  10. ;
  11. ; This program is free software; you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 2 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program; if not, write to the Free Software
  23. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. (define (apply-glossy-logo-effect img
  26.                   logo-layer
  27.                   blend-gradient-text
  28.                   blend-gradient-text-reverse
  29.                   blend-gradient-outline
  30.                   blend-gradient-outline-reverse
  31.                   grow-size
  32.                   bg-color
  33.                   use-pattern-text
  34.                   pattern-text
  35.                   use-pattern-outline
  36.                   pattern-outline
  37.                   use-pattern-overlay
  38.                   pattern-overlay
  39.                   noninteractive
  40.                   shadow-toggle
  41.                   s-offset-x
  42.                   s-offset-y)
  43.   (let* ((width (car (gimp-drawable-width logo-layer)))
  44.          (height (car (gimp-drawable-height logo-layer)))
  45.          (posx (- (car (gimp-drawable-offsets logo-layer))))
  46.          (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  47.          (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  48.          (grow-me (car (gimp-layer-copy logo-layer TRUE)))
  49.          (dont-drop-me))
  50.  
  51.     (gimp-context-push)
  52.  
  53.     (script-fu-util-image-resize-from-layer img logo-layer)
  54.     (gimp-drawable-set-name grow-me "Grow-me")
  55.     (gimp-image-add-layer img grow-me 1)
  56.     (gimp-layer-translate grow-me posx posy)
  57.     (gimp-image-add-layer img bg-layer 2)
  58.  
  59.     (gimp-context-set-background bg-color)
  60.     (gimp-selection-all img)
  61.     (gimp-edit-bucket-fill bg-layer BG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  62.     (gimp-selection-none img)
  63.  
  64.     (gimp-selection-layer-alpha logo-layer)
  65.  
  66. ; if we are going to use transparent gradients for text, we will (maybe) need to uncomment this
  67. ; this clears black letters first so you don't end up with black where the transparent should be
  68. ;    (gimp-edit-clear img logo-layer)
  69.  
  70.     (if (= use-pattern-text TRUE)
  71.       (begin
  72.         (gimp-context-set-pattern pattern-text)
  73.         (gimp-edit-bucket-fill logo-layer
  74.                    PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)))
  75.  
  76.     (if (= use-pattern-text FALSE)
  77.       (begin
  78.         (gimp-context-set-gradient blend-gradient-text)
  79.  
  80.         (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
  81.              GRADIENT-LINEAR 100 0 REPEAT-NONE
  82.              blend-gradient-text-reverse
  83.              FALSE 0 0 TRUE
  84.              0 0 0 (+ height 5))))
  85.  
  86.     (gimp-selection-none img)
  87.  
  88.     (gimp-selection-layer-alpha grow-me)
  89.     (gimp-selection-grow img grow-size)
  90.  
  91. ; if we are going to use transparent gradients for outline, we will (maybe) need to uncomment this
  92. ; I didn't put it in the options because there are already enough settings there and anyway, transparent
  93. ; gradients will be used very rarely (if ever)
  94. ;    (gimp-edit-clear img grow-me)
  95.  
  96.     (if (= use-pattern-outline TRUE)
  97.       (begin
  98.         (gimp-context-set-pattern pattern-outline)
  99.         (gimp-edit-bucket-fill grow-me
  100.                    PATTERN-BUCKET-FILL NORMAL-MODE 100
  101.                    0 FALSE 0 0)))
  102.  
  103.     (if (= use-pattern-outline FALSE)
  104.       (begin
  105.         (gimp-context-set-gradient blend-gradient-outline)
  106.  
  107.         (gimp-edit-blend grow-me CUSTOM-MODE NORMAL-MODE
  108.              GRADIENT-LINEAR 100 0 REPEAT-NONE
  109.              blend-gradient-outline-reverse
  110.              FALSE 0 0 TRUE
  111.              0 0 0 (+ height 5))))
  112.  
  113.     (gimp-selection-none img)
  114.  
  115.     (plug-in-bump-map noninteractive img grow-me logo-layer
  116.               110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
  117.     (gimp-layer-set-mode logo-layer SCREEN-MODE)
  118.  
  119.     (if (= use-pattern-overlay TRUE)
  120.       (begin
  121.         (gimp-selection-layer-alpha grow-me)
  122.         (gimp-context-set-pattern pattern-overlay)
  123.         (gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL
  124.                    OVERLAY-MODE 100 0 FALSE 0 0)
  125.         (gimp-selection-none img)))
  126.  
  127.     (if (= shadow-toggle TRUE)
  128.       (begin
  129.     (gimp-selection-layer-alpha logo-layer)
  130.     (set! dont-drop-me (car (script-fu-drop-shadow img logo-layer
  131.                                s-offset-x s-offset-y
  132.                                15 '(0 0 0) 80 TRUE)))
  133.         (set! width (car (gimp-image-width img)))
  134.         (set! height (car (gimp-image-height img)))
  135.         (gimp-selection-none img)))
  136.  
  137.   (gimp-context-pop)))
  138.  
  139.  
  140. (define (script-fu-glossy-logo-alpha img
  141.                      logo-layer
  142.                      blend-gradient-text
  143.                      blend-gradient-text-reverse
  144.                      blend-gradient-outline
  145.                      blend-gradient-outline-reverse
  146.                      grow-size
  147.                      bg-color
  148.                      use-pattern-text
  149.                      pattern-text
  150.                      use-pattern-outline
  151.                      pattern-outline
  152.                      use-pattern-overlay
  153.                      pattern-overlay
  154.                      noninteractive
  155.                      shadow-toggle
  156.                      s-offset-x
  157.                      s-offset-y)
  158.   (begin
  159.     (gimp-image-undo-group-start img)
  160.     (apply-glossy-logo-effect img logo-layer
  161.                   blend-gradient-text
  162.                   blend-gradient-text-reverse
  163.                   blend-gradient-outline
  164.                   blend-gradient-outline-reverse
  165.                   grow-size bg-color
  166.                   use-pattern-text pattern-text
  167.                   use-pattern-outline pattern-outline
  168.                   use-pattern-overlay pattern-overlay
  169.                   noninteractive shadow-toggle
  170.                   s-offset-x s-offset-y)
  171.     (gimp-image-undo-group-end img)
  172.     (gimp-displays-flush)))
  173.  
  174.  
  175. (script-fu-register "script-fu-glossy-logo-alpha"
  176.                     _"Glo_ssy..."
  177.                     "Creates anything you can create with it :)"
  178.                     "Hrvoje Horvat (hhorvat@open.hr)"
  179.                     "Hrvoje Horvat"
  180.                     "14/04/1998"
  181.             "RGBA"
  182.                     SF-IMAGE      "Image"                     0
  183.                     SF-DRAWABLE   "Drawable"                  0
  184.                     SF-GRADIENT   _"Blend gradient (text)"    "Shadows 2"
  185.             SF-TOGGLE     _"Text gradient reverse"    FALSE
  186.                     SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  187.             SF-TOGGLE     _"Outline gradient reverse" FALSE
  188.                     SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  189.             SF-COLOR      _"Background color"         '(255 255 255)
  190.             SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  191.             SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  192.             SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  193.             SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  194.             SF-TOGGLE     _"Use pattern overlay"      FALSE
  195.             SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  196.             SF-TOGGLE     _"Default bumpmap settings" TRUE
  197.             SF-TOGGLE     _"Shadow"                   TRUE
  198.             SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  199.                     SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1))
  200.  
  201. (script-fu-menu-register "script-fu-glossy-logo-alpha"
  202.              _"<Image>/Script-Fu/Alpha to Logo")
  203.  
  204.  
  205. (define (script-fu-glossy-logo text
  206.                    size
  207.                    font
  208.                    blend-gradient-text
  209.                    blend-gradient-text-reverse
  210.                    blend-gradient-outline
  211.                    blend-gradient-outline-reverse
  212.                    grow-size
  213.                    bg-color
  214.                    use-pattern-text
  215.                    pattern-text
  216.                    use-pattern-outline
  217.                    pattern-outline
  218.                    use-pattern-overlay
  219.                    pattern-overlay
  220.                    noninteractive
  221.                    shadow-toggle
  222.                    s-offset-x
  223.                    s-offset-y)
  224.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  225.      (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font))))
  226.     (gimp-image-undo-disable img)
  227.     (gimp-drawable-set-name text-layer text)
  228.     (apply-glossy-logo-effect img text-layer
  229.                   blend-gradient-text
  230.                   blend-gradient-text-reverse
  231.                   blend-gradient-outline
  232.                   blend-gradient-outline-reverse
  233.                   grow-size bg-color
  234.                   use-pattern-text pattern-text
  235.                   use-pattern-outline pattern-outline
  236.                   use-pattern-overlay pattern-overlay
  237.                   noninteractive shadow-toggle
  238.                   s-offset-x s-offset-y)
  239.     (gimp-image-undo-enable img)
  240.     (gimp-display-new img)))
  241.  
  242. (script-fu-register "script-fu-glossy-logo"
  243.                     _"Glo_ssy..."
  244.                     "Creates anything you can create with it :)"
  245.                     "Hrvoje Horvat (hhorvat@open.hr)"
  246.                     "Hrvoje Horvat"
  247.                     "14/04/1998"
  248.                     ""
  249.                     SF-STRING     _"Text"                     "Galaxy"
  250.                     SF-ADJUSTMENT _"Font size (pixels)"       '(100 2 1000 1 10 0 1)
  251.                     SF-FONT       _"Font"                     "Eras"
  252.                     SF-GRADIENT   _"Blend gradient (Text)"    "Shadows 2"
  253.             SF-TOGGLE     _"Text gradient reverse"    FALSE
  254.                     SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  255.             SF-TOGGLE     _"Outline gradient reverse" FALSE
  256.                     SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  257.             SF-COLOR      _"Background color"         '(255 255 255)
  258.             SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  259.             SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  260.             SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  261.             SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  262.             SF-TOGGLE     _"Use pattern overlay"      FALSE
  263.             SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  264.             SF-TOGGLE     _"Default bumpmap settings" TRUE
  265.             SF-TOGGLE     _"Shadow"                   TRUE
  266.             SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  267.                     SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1))
  268.  
  269. (script-fu-menu-register "script-fu-glossy-logo"
  270.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  271.